package com.jinduplan.planmanager.mvp.model

import android.database.Observable
import com.cxz.kotlin.baselibs.mvp.BaseModel
import com.cxz.kotlin.baselibs.utils.GsonHelper
import com.jinduplan.planmanager.bean.HttpResult
import com.jinduplan.planmanager.bean.PersonalModifyBean
import com.jinduplan.planmanager.bean.PicSignSuccess
import com.jinduplan.planmanager.bean.PicUploadSuccess
import com.jinduplan.planmanager.http.MainRetrofit
import com.jinduplan.planmanager.mvp.contract.PersonalContract
import com.jinduplan.planmanager.mvp.contract.TestContract

/**
 * @author chenxz
 * @date 2018/12/1
 * @desc
 */
class PersonalModel : BaseModel(), PersonalContract.Model {
    override fun unloadPics(url: String): io.reactivex.rxjava3.core.Observable<HttpResult<PersonalModifyBean>> {
        return MainRetrofit.service.modifyAvatar(GsonHelper.uploadSinglePart(url,"avatar"))

    }

    override fun modifyNickName(name: String): io.reactivex.rxjava3.core.Observable<HttpResult<Any>> {
        return MainRetrofit.service.modifyNickName(GsonHelper.getRequestBoby(arrayListOf("nick_name"),
            arrayListOf(name)))
    }


}